package com.battle.service.controller.web;

import com.battle.pojo.param.userShare.*;
import com.battle.pojo.vo.userShare.*;
import com.battle.service.service.in.*;
import nirvana.core.domains.vo.PageResult;
import nirvana.core.domains.vo.ApiResult;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.Valid;

import java.util.List;

/**
 * web/用户分享
 * 【描 述】：
 * 【环 境】：J2SE
 * 【详 细】：
 */
@RestController
@RequestMapping("/userShare/web")
public class UserShareWebController {

    private final UserShareService service;

    public UserShareWebController(UserShareService service) {
        this.service = service;
    }


    /**
     * 创建用户分享
     *
     * @param param
     * @return
     */
    @PostMapping("/createUserShare")
    public ApiResult createUserShare(@RequestBody @Valid CreateUserShareParam param) {
        service.createUserShare(param);
        return ApiResult.ok();
    }


    /**
     * 获取用户分享列表
     *
     * @param param
     * @return
     */
    @PostMapping("/getUserShareList")
    public ApiResult<PageResult<GetUserShareListVo>> getUserShareList(@RequestBody GetUserShareListParam param) {
        PageResult<GetUserShareListVo> result = service.getUserShareList(param);
        return ApiResult.ok(result);
    }


}

